<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateMenu extends Migrator
{

    public function up()
    {
        $table = $this->table('menu',['signed'=>false]);
        $table->addColumn('name','string',['limit'=>120,'comment'=>'菜单名称'])
              ->addColumn('parent_id','integer',['default'=>null,'null'=>true,'comment'=>'父菜单id'])
              ->addForeignKey('parent_id','menu','id',['delete'=> 'CASCADE'])
              ->addColumn('is_directory','boolean',['default'=>false,'comment'=>'是否拥有子菜单'])
              ->addColumn('level','integer',['limit'=>11,'default'=>0,'comment'=>'当前菜单层级'])
              ->addColumn('path','string',['limit'=>255,'default'=>'-','comment'=>'该菜单所有父菜单'])
             ->addColumn('jump_url','string',['limit'=>255,'default'=>'','comment'=>'跳转地址'])
             ->addColumn('icon_name','string',['limit'=>255,'default'=>'','comment'=>'菜单图标'])
             ->addColumn('is_hide','integer',['limit'=>1,'default'=>0,'comment'=>'是否隐藏 0 1 '])
            ->addColumn('remark','string',['limit'=>255,'default'=>'','comment'=>'备注'])
            ->addColumn('create_time','integer',['limit'=>10,'default'=>0,'comment'=>'创建时间'])
            ->addColumn('update_time','integer',['limit'=>10,'default'=>0,'comment'=>'更新时间'])
             ->create();
    }
    public function down(){
        $this->dropTable('menu');
    }


}
